FROM FROM jenkins/slave:3.29-1
MAINTAINER tiandong19860806@126.com

USER root

RUN mkdir -p /soft/maven/ && mkdir -p /usr/local/maven && mkdir -p /usr/local/java && \
wget -O /soft/maven/maven-3.5.4.tar.gz  -c https://github.com/apache/maven/archive/maven-3.5.4.tar.gz && \
tar -zxvf /soft/maven/maven-3.5.4.tar.gz -C /soft/maven/

ls -al

RUN cp -rf /soft/maven/maven-maven-3.5.4/apache-maven/src/* /usr/local/maven
COPY jdk1.8.0_171       /usr/local/java
COPY kubectl            /usr/local/bin/kubectl
COPY libltdl.so.7 /usr/lib64/libltdl.so.7
COPY slave.jar /usr/share/jenkins/slave.jar 
COPY jenkins-slave /usr/local/bin/jenkins-slave

ENV HOME /home/jenkins
ENV AGENT_WORKDIR=/home/jenkins/agent
ENV JAVA_HOME /usr/local/java
ENV MAVEN_HOME /usr/local/maven/
ENV CLASSPATH .:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
ENV PATH ${JAVA_HOME}/bin:${MAVEN_HOME}/bin:${PATH} 
ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2"

RUN  chmod 755 /usr/share/jenkins \
  && chmod 644 /usr/share/jenkins/slave.jar 

RUN mkdir -p /home/jenkins/.jenkins \
 && mkdir -p ${AGENT_WORKDIR} \
 && yum -y install git subversion sshpass

VOLUME /home/jenkins/.jenkins
VOLUME ${AGENT_WORKDIR}
WORKDIR /home/jenkins

ENTRYPOINT ["jenkins-slave"]